package com.ztjy.purchase.biz.impl;

import com.ztjy.bean.CDetails;
import com.ztjy.purchase.biz.CDetailsBiz;
import com.ztjy.purchase.dao.CDetailsDao;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
@Service
public class CDetailsBizImpl implements CDetailsBiz {
    @Autowired
    private CDetailsDao cddao;
    @Override
    public List<CDetails> findAll() {
        return cddao.findAll();
    }

    @Override
    public List<CDetails>findByIdCDetails(String id) {
        return cddao.findByIdCDetails(id);
    }

    @Override
    public boolean addCDetails(CDetails cDetails) {
        int i = cddao.insertSelective(cDetails);
        return (i!=0)?true:false;
    }

    @Override
    public boolean delCDetails(String purchaseId) {
        return cddao.delDetails(purchaseId);
    }

    @Override
    public boolean updateCDetails(CDetails cDetails) {
        boolean flag=false;
        try {
            flag=cddao.updateByPrimaryKeySelective(cDetails);
        }catch (Exception e){
            e.printStackTrace();
            flag=false;
        }
        return flag;
    }

    @Override
    public CDetails findCDetailsByDid(Integer detailsId) {
        return cddao.findCDetailsByDid(detailsId);
    }


}
